Between September 10th and November 26th, 2019, embRACE LA:
* collected 542 online surveys from Angelinos who either live, work, or study in the city(i);
* held 11 conversations with city council members; and
* collected 112 pre-conversation and 80 post-conversation surveys from dinner participants.
The following reviews the results from the surveys and dinner conversations. Key takeaways include:
* Angelinos who participated in embRACE LA (either through the survye or dinner conversations) generally do not believe LA City is an equitable and inclusive place to live.
* Housing is viewed as a major barrier to creating greater equity as is racism and discrimination.
* Many do no trust the city to treat people equally or provide equal city services. * The overwhelming majority believe the city should prioritize equity and the great majority of embRACE dinner participants support an ORE.
* Community respondents and dinner participants prioritize activities for the ORE that involve tangible investments in community, like applying equitable budgeting tools to invest based on need, investing in local minority-owneded businesses, providing grants to local organizations working on equity, and hiring diverse city staff from local communities.
*(i)Note: A total of 567 community surveys were gathered on the website, but only 542 of these were from individuals who reported either living, working, or studying in LA City. This analysis does not include the 25 individuals without a connection to LA City.
Only 22% of Angelinos who took the survey agreed or strongly agreed that LA City is an equitable and inclusive place to live for people of all races and ethnicities.
Only 26% of people attending our dinners agreed or strongly agreed with the same statement.
Community respondents most frequently ranked housing affordability, gentrification and displacement, and racism and discrimination as the top 3 barriers to creating a more equitable LA. In fact, over 50% of respondents thought housing affordability was one of the top 3 barriers to greater equity in LA City.
Dinner participants most frequently ranked housing affordability, income, and racism and discrimination as the top 3 barriers to creating a more equitable LA.
Over 50% of both community respondents and dinner participants thought housing affordability was one of the top 3 barriers to greater equity in LA.
30% or more of both community respondents and dinner participants thought racism and discrimination was one of the top 3 barriers to greater equity in LA.
About 3 in 4 of community respondents had little or no trust in the city to provide equal city services (X%) or equal opportunities to participate in decision-making for all people (X%).
Dinner participants were slightly more trusting of the city though than 50% of reported little trust or no trust at all in the city to treat people of all races and ethnicities equally equal city services, equal opportunities to participate in city decision-making, or generally equal treatment.
is_la_equitable <- dbGetQuery(con, "SELECT * FROM commsurvey_is_la_equitable") #grab view from potsgres
#formating
is_la_equitable_count<-c('n=21', 'n=95', 'n=79', 'n=229', 'n=116')
equitable_x<-list(title="",
tickformat="%")
equitable_y<-list(title="")
#graph
plot_ly(is_la_equitable, x=~pct , y=~fct_rev(factor(is_la_equitable, levels=is_la_equitable)), type = 'bar', text=is_la_equitable_count, orientation='h')%>%
layout(title= str_wrap("LA City is an equitable and inclusive place to live for people of all races and ethnicities"), xaxis=equitable_x, yaxis=equitable_y, autosize=F)
pre_is_la_equitable <- dbGetQuery(con, "SELECT * FROM presurvey_is_la_equitable") #grab view from potsgres
#formating
pre_is_la_equitable_freq<-c('n=5', 'n=23', 'n=17', 'n=48', 'n=18')
equitable_x<-list(title="",
tickformat="%")
equitable_y<-list(title="")
#graph
plot_ly(pre_is_la_equitable, x=~percent , y=~fct_rev(factor(response, levels=response)), type = 'bar', text=pre_is_la_equitable_freq, orientation='h')%>%
layout(title= str_wrap("LA City is an equitable and inclusive place to live for people of all races and ethnicities"), xaxis=equitable_x, yaxis=equitable_y)
barriers_to_equity<-dbGetQuery(con, "SELECT response, freq, percent FROM commsurvey_barriers_to_equity WHERE percent > 26 OR percent < 6")
kable(barriers_to_equity, digits=0, col.names=c("Response","Frequency","Percent (%)"))%>%
kable_styling(bootstrap_options = "striped")%>%
row_spec(1:3, bold = T, color ="white", background="#65B23E")%>%
row_spec(4:8, bold=T, color= "white", background="#E53939")%>%
add_header_above(c("What are the top 3 barriers to creating a more equitable and inclusive city?"=1," "=2))
| Response | Frequency | Percent (%) |
|---|---|---|
| Housing affordability | 310 | 57 |
| Gentrification and displacement | 201 | 37 |
| Racism and discrimination | 184 | 34 |
| Public participation | 29 | 5 |
| Environmental justice | 29 | 5 |
| Public safety | 28 | 5 |
| Food security | 22 | 4 |
| City services | 14 | 3 |
pre_barriers_to_equity<-dbGetQuery(con, "SELECT response, freq, percent FROM presurvey_barriers_to_equity WHERE percent > 30 OR percent < 7")
#top 3 and bottom 5
kable(pre_barriers_to_equity, digits=0, col.names=c(" ","Count","Percent (%)"))%>%
kable_styling(bootstrap_options = "striped")%>%
row_spec(1:3, bold = T, color ="white", background="#65B23E")%>%
row_spec(4:6, bold=T, color= "white", background="#E53939")%>%
add_header_above(c("What are the top 3 barriers to creating a more equitable and inclusive city?"=1," "=2))
| Count | Percent (%) | |
|---|---|---|
| Housing affordability | 58 | 52 |
| Income | 35 | 31 |
| Racism and discrimination | 34 | 30 |
| Food security | 6 | 5 |
| Infrastructure | 5 | 4 |
| City services | 3 | 3 |
trust<-dbGetQuery(con, "SELECT * FROM commsurvey_trust_la_city")
trust$question_text<-trimws(trust$question_text, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") #remove whitespace from 'question_text' column
##This creates the order we want for the 'question_text:
trust$factor<-factor(trust$question_text, ordered=TRUE, levels=c("How much do you trust LA City staff to treat people of all races and ethnicities equally?", "How much do you trust LA City to provide equal city services to all people?","How much do you trust LA City government to provide equal opportunities for all people to participate in city decision-making?"))
##This creates the order we want for 'response'
trust$legend <- factor(trust$response, ordered = TRUE, levels=c("A great deal of trust","A fair amount of trust","Little trust","No trust at all"))
##final graph
ggplot(data=trust, aes(x=fct_rev(factor), y= percent, fill=legend), margin=list(r=500), length=1000) + geom_bar(stat="identity") + scale_x_discrete(name="", labels = function(x) str_wrap(x, width = 20)) + scale_y_continuous(name="", labels=scales::percent)+ geom_text(aes(label=freq), position=position_stack(vjust=.5), size = 3)+scale_fill_brewer(palette='Blues') + coord_flip()+labs(fill="")
presurvey_trust<-dbGetQuery(con, "SELECT * FROM presurvey_trust_la_city")
presurvey_trust$question_text<-trimws(presurvey_trust$question_text, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") #remove whitespace from 'question_text' column
##This creates the order we want for the 'question_text:
presurvey_trust$factor<-factor(presurvey_trust$question_text, ordered=TRUE, levels=c("How much do you trust LA City staff to treat people of all races and ethnicities equally?", "How much do you trust LA City to provide equal city services to all people?","How much do you trust LA City government to provide equal opportunities for all people to participate in city decision-making?"))
##This creates the order we want for 'response'
presurvey_trust$legend <- factor(presurvey_trust$response, ordered = TRUE, levels=c("A great deal of trust","A fair amount of trust","Little trust","No trust at all"))
##final graph
ggplot(data=presurvey_trust, aes(x=fct_rev(factor), y= percent, fill=legend)) + geom_bar(stat="identity") + scale_x_discrete(name="", labels = function(x) str_wrap(x, width = 20)) + scale_y_continuous(name="", labels=scales::percent)+geom_text(aes(label=freq), position=position_stack(vjust=.5), size = 3)+scale_fill_brewer(palette='Blues')+coord_flip()
#plot_ly(presurvey_trust, x=~question_text, y=~percent, type='bar', orientation='h', name='question_text')%>%
# layout(barmode='stack', xaxis=list(title=" "), yaxis=list(title=' '))
# pre_trust_x<-list(title="", tickformat="%")
# pre_trust_y<-list(title="")
#plot_ly(presurvey_trust, x = ~"No trust at all", y = ~question_text, type = 'bar', name = 'No trust at all', orientation='h') %>%add_trace(X = ~"Little trust", name = "Little trust") %>% add_trace(X = ~"A fair amount of trust", name = "A fair amount of trust") %>% add_trace(X = ~"A great deal of trust", name = "A great deal of trust") %>%layout(xaxis = list(title = "", showgrid = FALSE,
# showline = FALSE,
# showticklabels = FALSE,
# zeroline = FALSE),
# yaxis = list(title = "",
# showgrid = FALSE,
# showline = FALSE,
# showticklabels = FALSE,
# zeroline = FALSE),barmode = 'stack')
equity_priority<-dbGetQuery(con, 'SELECT * FROM commsurvey_equity_priority')
#formatting
equity_priority_text<-c('n=451', 'n=74', 'n=15')
priority_x<-list(title="", tickformat="%")
priority_y<-list(title="")
#graph
plot_ly(equity_priority, x=~pct , y=~fct_rev(factor(equity_priority, levels=equity_priority)), type = 'bar', text=equity_priority, orientation='h')%>%
layout(title= str_wrap("How much of a priority should creating greater equity and inclusivity in our city be to LA City government and officials?"), strwrap(equity_priority$pct, width=10), xaxis=priority_x, yaxis=priority_y)
pre_equity_priority<-dbGetQuery(con, 'SELECT * FROM presurvey_equity_priority')
pre_equity_priority$response<-trimws(pre_equity_priority$response, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") #remove whitespace from 'question_text' column
#formatting
pre_equity_priority$factor <- factor(pre_equity_priority$response, ordered = TRUE, levels=c("High priority","Somewhat of a priority","Not a priority"))
priority_x<-list(title="", tickformat="%")
priority_y<-list(title="")
#graph
plot_ly(pre_equity_priority, x=~percent, y=~fct_rev(factor), type ='bar', text=pre_equity_priority, orientation='h')%>%
layout(title= str_wrap("How much of a priority should creating greater equity and inclusivity in our city be to LA City government and officials?"), xaxis=priority_x, yaxis=priority_y)
post_support<-dbGetQuery(con, 'SELECT * FROM postsurvey_ore_support')
post_support$response<-trimws(post_support$response, which = c("both", "left", "right"), whitespace = "[ \t\r\n]") #remove whitespace from 'question_text' column
#formatting
post_support$factor <- factor(post_support$response, ordered = TRUE, levels=c("Strongly support","Support", "Neither oppose or support", "Oppose", "Strongly oppose"))
support_x<-list(title="", tickformat="%")
support_y<-list(title="")
#graph
plot_ly(post_support, x=~percent, y=~fct_rev(factor), type ='bar', text=post_support, orientation='h')%>%
layout(title= "How much do you support creating an Office of Racial Equity in LA City?", xaxis=support_x, yaxis=support_y)
Community respondents most frequently thought the city should invest dollars based on community need (69%), invest in local minority-owned businesses (64%), and make grants to local organizations that are addressing racial equity (60%) in order to work toward greater equity in LA.
When asked to prioritize what the city should do first with an ORE, dinner participants prioritized applying equitable budgeting tools to make city investments based on need (19%).
When asked to rate the potential of ORE activities to impact racial equity, dinner participants most often rated local minority-owned business (76%), application of equitable budgeting tools (75%), hiring of diverse staff from local communities (69%), and grants to local community organizations (68%) as having a potentially “high” impact on racial equity.
#grab view and apply filters
equity_activities<-dbGetQuery(con, "SELECT response, freq, percent FROM commsurvey_greater_equity WHERE percent > .6 or percent < .55 and percent > .44")
equity_activities$percent<-paste(round(equity_activities$percent*100,digits=0),"%",sep="") #change column from decimals to percents for percentage
#Create table
kable(equity_activities, digits=2, col.names=c("Response","Frequency","Percent"))%>%
kable_styling(bootstrap_options = "striped")%>%
row_spec(1:3, bold = T, color ="white", background="#65B23E")%>%
row_spec(4:7, bold=T, color= "white", background="#E53939")%>%
add_header_above(c("What should LA City do about equity"=1," "=2))
| Response | Frequency | Percent |
|---|---|---|
| City investments and dollars distributed based on community need | 371 | 69% |
| Investments in local minority-owned businesses | 343 | 64% |
| Grants to local community organizations that are addressing racial equity | 325 | 60% |
| Conversations between City staff and community members about community needs | 296 | 55% |
| Collecting and analyzing data on racial equity and sharing it with the public | 291 | 54% |
| Opportunities and spaces for communities to come together on their own and solve issues | 250 | 46% |
| Guided conversations between community members about race and racism | 238 | 44% |
post_first<-dbGetQuery(con, 'SELECT * FROM postsurvey_ore_first_action')
post_first_top<-dbGetQuery(con, "SELECT response, freq, percent FROM postsurvey_ore_first_action where percent>.10 or percent<.05")
post_first_top$percent<-paste(round(post_first_top$percent*100,digits=0),"%",sep="") #change column from decimals to percents for percentage
kable(post_first_top, digits=0, col.names=c("Activity","Count","Percent"))%>%
kable_styling(bootstrap_options = "striped")%>%
row_spec(1:4, bold = T, color ="white", background="#3498DB")%>%
row_spec(5:6, bold=T, color= "white", background="#737373")%>%
add_header_above(c("What should an Office of Racial Equity do first? (top and bottom activities)"=1," "=2))
| Activity | Count | Percent |
|---|---|---|
| Application of equitable budgeting tools to make city investments based on need | 15 | 19% |
| Hiring diverse city staff from local communities | 9 | 11% |
| Investments in local minority-owned businesses | 9 | 11% |
| Application of a Racial Equity Impact analysis for city officials to use when making policy decisions | 8 | 10% |
| Grants to local community organizations that are addressing racial equity | 3 | 4% |
| Trainings for city staff on implicit bias, race, and racism | 2 | 3% |
# keeping for good measure
#post_first$wrapped <- sapply(post_first$response,
# FUN = function(question_text) {paste(strwrap(question_text, width = 40), collapse = "<br>")}) ##wrap text for y axis
#post_x<-list(title="", tickformat="%")
#post_y<-list(title="")
#plotly graph
#plot_ly(post_first, x=~percent, y=~reorder(wrapped, percent), type ='bar', text=post_first, orientation='h', margin=list(l=400, b=200), #height=1000)%>%
# layout(strwrap(post_first, width=20),title="What action should an Office of Racial Equity do first in LA city?", xaxis=post_x, yaxis=post_y)
post_impact<-dbGetQuery(con, 'SELECT * FROM postsurvey_action_impact')
post_high_impact <- filter(post_impact[order(-post_impact$percent) , ], response == "High impact")
post_impact_trim<- subset(post_high_impact, select = c(question_text, freq, percent))
post_impact_trim$percent<-paste(round(post_impact_trim$percent,digits=0),"%",sep="") #round percentage
kable(post_impact_trim, digits=0, col.names=c("Activity","Count","Percent High Impact"))%>%
kable_styling(bootstrap_options = "striped")%>%
row_spec(1:4, bold = T, color ="white", background="#3498DB")%>%
row_spec(5:8, bold = T, color ="white", background="#DCDCDC")%>%
row_spec(9:12, bold=T, color= "white", background="#808080")%>%
add_header_above(c("What should an Office of Racial Equity do first? (top and bottom activities)"=1," "=2))
| Activity | Count | Percent High Impact |
|---|---|---|
| Investments in local minority-owned businesses. | 61 | 1% |
| Application of equitable budgeting tools to make city investments based on community need. | 59 | 1% |
| Hiring diverse city staff from local communities. | 55 | 1% |
| Grants to local community organizations that are addressing racial equity. | 54 | 1% |
| Application of a Racial Equity Impact analysis for city officials to use when making policy decisions. | 50 | 1% |
| Collecting and analyzing data on racial equity and sharing it with the public. | 50 | 1% |
| Trainings for city staff on implicit bias, race and racism. | 49 | 1% |
| Trainings for community residents on how to participate in city government. | 49 | 1% |
| Setting racial equity action plans that outline vision, strategies, and actions for the office and city departments. | 47 | 1% |
| Guided conversations between community members about race and racism. | 47 | 1% |
| Establishment of a community oversight commission for the Office of Racial Equity. | 44 | 1% |
| Implementation of civic engagement standards to improve public participation in city decision-making. | 44 | 1% |
#post_x<-list(title="")
#post_y<-list(title="", labels = function (y) str_wrap(y, width = 20))
#post_high_impact$wrapped <- sapply(post_high_impact$question_text,
# FUN = function(question_text) {paste(strwrap(question_text, width = 40), collapse = "<br>")}) ##wrap text for y axis
#plot_ly(post_high_impact, x=~percent, y=~reorder(wrapped, percent), type ='bar', text=post_high_impact, orientation='h', margin=list(l=400, b=200), height=1000)%>%
# layout(title="Potential ORE Functions based on Ratings of High Impact", xaxis=post_x, yaxis=post_y)
Zip codes of respondents who indicated they live in LA. Size of data represents number of individuals who reponded at that zip code
#get zip data
zips_living<-read.csv(file ="W:/Project/OSI/EmbRACELA/Data/CommunitySurvey/commsurvey_zips_living_geocoded.csv", header=TRUE, sep=",")
#zips_total<-read.csv(file = "commsurvey_zips_total_geocoded.csv", header=TRUE, sep=",")
# Making sure we are working with rows that don't have any blanks
zips_living <- zips_living[complete.cases(zips_living),]
#zips_total <- zips_total[complete.cases(zips_total),]
#Import city council districts shapefile
cds <- st_read(
"W:/Project/OSI/EmbRACELA/Data/CommunitySurvey/CnclDist_July2012/CnclDist_July2012.shp")
## Reading layer `CnclDist_July2012' from data source `W:\Project\OSI\EmbRACELA\Data\CommunitySurvey\CnclDist_July2012\CnclDist_July2012.shp' using driver `ESRI Shapefile'
## Simple feature collection with 15 features and 10 fields
## geometry type: POLYGON
## dimension: XY
## bbox: xmin: 6359578 ymin: 1715011 xmax: 6514633 ymax: 1945515
## epsg (SRID): NA
## proj4string: +proj=lcc +lat_1=34.03333333333333 +lat_2=35.46666666666667 +lat_0=33.5 +lon_0=-118 +x_0=2000000 +y_0=500000.0000000001 +datum=NAD83 +units=us-ft +no_defs
cds <- st_transform(cds, CRS("+proj=longlat +datum=WGS84 +no_defs"))
#cds <- spTransform(cds, CRS("+proj=longlat +ellps=GRS80"))
######map of council districts with zip codes of respondants who live in LA
#######point data sized by count per zip code
leaflet(cds) %>%
addPolygons(color = "#444444", weight = 1, smoothFactor = 0.5,
opacity = 1.0, fillOpacity = 0.5)%>%
addProviderTiles(providers$CartoDB.Positron)%>%
addCircleMarkers(data = zips_living, lng = ~X, lat = ~Y,
weight = 1, radius = ~count, fillOpacity = .9,
color="blue")
race <- dbGetQuery(con, "SELECT * FROM commsurvey_race") #grab race view from potsgres
race_count<-c('n=6', 'n=45', 'n=123', 'n=161', 'n=6', 'n=49', 'n=137') #create hover text for n
#create formatting for x axis: no title, and decimals become whole percentages
race_x<-list(
title="",
tickformat="%")
#create formatting for y axis: no title
race_y<-list(
title=""
)
##come back to this and figure out ordering!
plot_ly(race, x = ~pct, y= ~(factor(race, levels=race)), type = 'bar', text = race_count, orientation='h')%>%
layout(title = "Race and Ethnicity of Respondants", xaxis=race_x, yaxis = race_y) #use the race_x and race_y lists created earlier to implement our desired axis formatting
pre_race <- dbGetQuery(con, "SELECT * FROM presurvey_raceethnicity_censuscomp") #grab race view from potsgres
#create formatting for x axis: no title, and decimals become whole percentages
pre_race_x<-list(
title="",
tickformat="%")
#create formatting for y axis: no title
pre_race_y<-list(
title="")
plot_ly(pre_race, x =~pct, y=~reorder(response, pct), type = 'bar')%>%
layout(xaxis=pre_race_x, yaxis = pre_race_y) #use the race_x and race_y lists created earlier to implement our desired axis formatting
demographics<-dbGetQuery(con, "SELECT * FROM commsurvey_demographics")
live_work<-demographics[c(5:14), c(1:5)] #subset data to only get the rows for the live-work questions
#remove whitespace from 'question_text' column
live_work$question_text<-trimws(live_work$question_text, which = c("both", "left", "right"), whitespace = "[ \t\r\n]")
##This creates the order we want for the 'question_text:
live_work$factor<-factor(live_work$question_text, ordered=TRUE, levels=c("How long have you worked in LA City?", "How long have you lived in LA City?"))
##This creates the order we want for 'response'
live_work$legend <- factor(live_work$response, ordered = TRUE, levels=c("Less than a year","1 to 5 years","6 to 10 years", "11 to 20 years","Over 20 years"))
##final graph
ggplot(data=live_work, aes(x=fct_rev(question_text), y= freq, fill=fct_rev(legend)), na.rm=TRUE) + geom_bar(stat="identity") + scale_x_discrete(name="", labels = function(x) str_wrap(x, width = 20)) + scale_y_continuous(name="") + geom_text(aes(label = freq),
position=position_stack(vjust = .5), size=3) + scale_fill_brewer("Blues")+ labs(title = "How many respondants live or work in Los Angeles", caption="Footnote: 57 respondants indicated that they attended school in Los Angeles.")+theme(legend.title=element_blank())
pre_live_work_study<-dbGetQuery(con, 'SELECT * FROM presurvey_demographics')
pre_live_work <- filter(pre_live_work_study, question_text %in% c("How long have you lived in LA City?", "How long have you worked in LA City?"))
#remove whitespace from 'question_text' column
pre_live_work$question_text<-trimws(pre_live_work$question_text, which = c("both", "left", "right"), whitespace = "[ \t\r\n]")
##This creates the order we want for the 'question_text:
pre_live_work$factor<-factor(pre_live_work$question_text, ordered=TRUE, levels=c("How long have you worked in LA City?", "How long have you lived in LA City?"))
##This creates the order we want for 'response'
pre_live_work$legend <- factor(pre_live_work$response, ordered = TRUE, levels=c("Less than a year","1 to 5 years","6 to 10 years","Over 10 years", "11 to 20 years","Over 20 years"))
##final graph
ggplot(data=pre_live_work, aes(x=fct_rev(question_text), y= freq, fill=fct_rev(legend)), na.rm=TRUE) + geom_bar(stat="identity") + scale_x_discrete(name="", labels = function(x) str_wrap(x, width = 20)) + scale_y_continuous(name="") + geom_text(aes(label = freq),
position=position_stack(vjust = .5), size=3) + scale_fill_brewer("Blues")+ labs(title = "How many respondants live or work in Los Angeles", caption="Footnote: 10 respondents indicated that they attended school in Los Angeles.")+theme(legend.title=element_blank())
gender<-dbGetQuery(con, 'SELECT * FROM commsurvey_gender')
gender_count<-c('n=364', 'n=154', 'n=15', 'n=2', 'n=1') ##manually setting hover text
gender_x<-list(title="", tickformat="%")
gender_y<-list(title="")
plot_ly(gender, x = ~pct, y=~fct_rev(factor(gender, levels=gender)), type = 'bar', text = gender_count, orientation='h')%>%
layout(strwrap(gender, width=20), xaxis=gender_x, yaxis=gender_y)
pre_demographics<-dbGetQuery(con, 'SELECT * FROM presurvey_demographics')
pre_gender <- filter(pre_demographics, question_text == "Which of the following best describes your gender?")
x<-list(title="", tickformat="%")
y<-list(title="")
plot_ly(pre_gender, x=~pct, y=~reorder(response, pct), type ='bar', text=pre_gender, orientation='h')%>%
layout(strwrap(pre_gender, width=20), title="Which of the following best describes your gender?", xaxis=x, yaxis=y)
age <- dbGetQuery(con, "SELECT * FROM commsurvey_age") #grab age view from potsgres
age_count<-c('n=26', 'n=175', 'n=146', 'n=71', 'n=59', 'n=48')
#format for x and y axis
age_x<-list(
title="",
tickformat="%"
)
age_y<-list(title="")
##graph
plot_ly(age, x = ~pct, y= ~fct_rev(factor(age, level=age)), type = 'bar', text = age_count, orientation='h')%>%
layout(xaxis=age_x, yaxis=age_y)
pre_demographics<-dbGetQuery(con, 'SELECT * FROM presurvey_demographics')
pre_age <- filter(pre_demographics, question_text == "What is your age?")
#format for x and y axis
pre_age_x<-list(
title="",
tickformat="%")
pre_age_y<-list(title="")
##graph
plot_ly(pre_age, x = ~pct, y= ~fct_rev(factor(response, level=response)), type = 'bar', orientation='h')%>%
layout(xaxis=pre_age_x, yaxis=pre_age_y)
On average, people attending our dinners had participated in X civic engagement activities over the past year, more than community survey respondents
ce<-dbGetQuery(con, "SELECT response, freq, percent FROM commsurvey_ce_activities WHERE percent > .60")
ce$percent<-paste(round(ce$percent*100,digits=0),"%",sep="") #change column from decimals to percents for percentage
#Create table
kable(ce, col.names=c("Response","Frequency","Percent (%)"))%>%
kable_styling(bootstrap_options = "striped")%>%
add_header_above(c("Top civic engagement activities are respondents involved with"=1," "=2))
| Response | Frequency | Percent (%) |
|---|---|---|
| Voted in an election | 388 | 72% |
| Signed a petition in-person or online | 372 | 69% |
| Volunteered in my community | 347 | 64% |
pre_ce<-dbGetQuery(con, "SELECT response, freq, percent FROM presurvey_ce_activities")
pre_ce_top <- filter(pre_ce, percent>.66)
pre_ce_top$percent<-paste(round(pre_ce_top$percent*100,digits=0),"%",sep="") #change column from decimals to percents for percentage
#Create table
kable(pre_ce_top, col.names=c("Activity","Count","Percent (%)"))%>%
kable_styling(bootstrap_options = "striped")%>%
add_header_above(c("Top civic engagement activities participants were involved with"=1," "=2))
| Activity | Count | Percent (%) |
|---|---|---|
| Volunteered in my community | 92 | 82% |
| Attended a community meeting | 92 | 82% |
| Attended a public meeting | 87 | 78% |
| Met with a government representative | 74 | 66% |
| Voted in an election | 74 | 66% |
pre_demographics<-dbGetQuery(con, 'SELECT * FROM presurvey_demographics')
represented <- filter(pre_demographics, question_text == "Who are you representing today?")
x<-list(title="", tickformat="%")
y<-list(title="")
plot_ly(represented, x=~pct, y=~reorder(response, pct), type ='bar', text=represented, orientation='h')%>%
layout(title="Who are you representing today?", xaxis=x, yaxis=y)